import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/drama_detail_entity.dart';

DramaDetailEntity $DramaDetailEntityFromJson(Map<String, dynamic> json) {
  final DramaDetailEntity dramaDetailEntity = DramaDetailEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    dramaDetailEntity.id = id;
  }
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    dramaDetailEntity.dramaId = dramaId;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    dramaDetailEntity.title = title;
  }
  final String? vid = jsonConvert.convert<String>(json['vid']);
  if (vid != null) {
    dramaDetailEntity.vid = vid;
  }
  final int? money = jsonConvert.convert<int>(json['money']);
  if (money != null) {
    dramaDetailEntity.money = money;
  }
  final int? isPay = jsonConvert.convert<int>(json['is_pay']);
  if (isPay != null) {
    dramaDetailEntity.isPay = isPay;
  }
  final int? ctime = jsonConvert.convert<int>(json['ctime']);
  if (ctime != null) {
    dramaDetailEntity.ctime = ctime;
  }
  return dramaDetailEntity;
}

Map<String, dynamic> $DramaDetailEntityToJson(DramaDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['drama_id'] = entity.dramaId;
  data['title'] = entity.title;
  data['vid'] = entity.vid;
  data['money'] = entity.money;
  data['is_pay'] = entity.isPay;
  data['ctime'] = entity.ctime;
  return data;
}

extension DramaDetailEntityExtension on DramaDetailEntity {
  DramaDetailEntity copyWith({
    int? id,
    int? dramaId,
    String? title,
    String? vid,
    int? money,
    int? isPay,
    int? ctime,
  }) {
    return DramaDetailEntity()
      ..id = id ?? this.id
      ..dramaId = dramaId ?? this.dramaId
      ..title = title ?? this.title
      ..vid = vid ?? this.vid
      ..money = money ?? this.money
      ..isPay = isPay ?? this.isPay
      ..ctime = ctime ?? this.ctime;
  }
}